<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>融资筛选列表</title>
<style type="text/css">
    .searchArea .fieldBox .label{width: 80px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
</style>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
          <div class="fieldBox" >
                <div class="label">融资基数</div>
                <div class="field">
                <input name="fncCrdnlt" id="fncCrdnlt" type="text" class="ui-textbox" data-name="fncCrdnlt" value="" ligerui="width: 200">
                </div>
            </div> 
            <div class="fieldBox">
                <div class="label">计划融资日期</div>
                <div class="field">
                
                <input name="stdt" id="stdt" type="text" class="ui-textbox" data-name="stdt" value="" ligerui="width: 90">
                <span>—</span>
				<input name="eddt" id="eddt" type="text" class="ui-textbox" data-name="eddt" value="" ligerui="width: 90">
                </div>
            </div>
			<div class="fieldBox">
                <div class="label">客户类型</div>
                <div class="field">
                <input name="cstTypCd" id="cstTypCd" type="text" class="ui-textbox" data-name="cstTypCd" value="" ligerui="width: 200">
                </div>
            </div>        
			<div class="fieldBox">
                <div class="label">所属事业部</div>
                <div class="field">
                <input name="buOrgCd" id="buOrgCd" type="text" class="ui-textbox" data-name="buOrgCd" value="" ligerui="width: 200">
                </div>
            </div>        
			<div class="fieldBox">
                <div class="label">是否办理抵押</div>
                <div class="field">
                <input name="isMortgage" id="isMortgage" type="text" class="ui-textbox" data-name="isMortgage" value="" ligerui="width: 200">
                </div>
            </div>        
			<div class="fieldBox">
                <div class="label">是否有保险</div>
                <div class="field">
                <input name="isInsurance" id="isInsurance" type="text" class="ui-textbox" data-name="isInsurance" value="" ligerui="width: 200">
                </div>
            </div>        
            <div class="fieldBox">
                <div class="label">租赁期数</div>
                <div class="field">
                   <input name="leaseTermMinQ" id="leaseTermMinQ" type="text" class="ui-textbox" data-name="leaseTermMinQ" value="" ligerui="width: 90">
                   <span>—</span>
                   <input name="leaseTermMaxQ" id="leaseTermMaxQ" type="text" class="ui-textbox" data-name="leaseTermMaxQ" value="" ligerui="width: 90">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">剩余租赁期数</div>
                <div class="field">
                   <input name="surplusLeaseTermMinQ" id="surplusLeaseTermMinQ" type="text" data-name="surplusLeaseTermMinQ" class="ui-textbox" value="" ligerui="width: 90">
                   <span>—</span>
                   <input name="surplusLeaseTermMaxQ" id="surplusLeaseTermMaxQ" type="text" data-name="surplusLeaseTermMaxQ" class="ui-textbox" value="" ligerui="width: 90">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">起租日期</div>
                <div class="field">
                   <input name="stDtQ" id="stDtQ" type="text" class="ui-textbox" data-name="stDtQ" value="" ligerui="width: 90">
                   <span>—</span>
                   <input name="edDtQ" id="edDtQ" type="text" class="ui-textbox" data-name="edDtQ" value="" ligerui="width: 90">
                </div>
            </div>
           <div class="fieldBox">
                <div class="label">逾期天数</div>
                <div class="field">
                   <input name="ovdDaysMin" id="ovdDaysMin" type="text" class="ui-textbox" data-name="ovdDaysMin" value="" ligerui="width: 90">
                   <span>—</span>
                   <input name="ovdDaysMax" id="ovdDaysMax" type="text" class="ui-textbox" data-name="ovdDaysMax" value="" ligerui="width: 90"> 
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">资产包名称</div>
                <div class="field">
                   <input name="assPackNm" id="assPackNm" type="text" class="ui-textbox" value="" ligerui="width: 200">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">支付表号</div>
                <div class="field">
                   <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="${paySchNo }" ligerui="width: 200">
                </div>
            </div>
            <div class="clearFix"></div>
            <div class="btnsBox formBtns notRight">
            	<!-- 隐藏融资筛选编号 -->
				<input name="applyId" id="applyId" type="hidden" class="ui-textbox" value="${id}">
				<input name="flag" id="flag" type="hidden" class="ui-textbox" value="${flag}">
				<input name="pianflag" id="pianflag" type="hidden" class="ui-textbox" value="${pianflag}">
            	<c:if test="${flag == '1' || flag == '0'}">
            		<span id="searchBtn" class="sq-button-round">查询</span>
            	</c:if>
            </div>
          </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid" style="height: 372px;"></div>

<script type="text/javascript">
	$(function () {
		initData();
		searchBtnEvent();//查询按钮事件 add by gengchunlan 20190813
	});
	
	var grid = null;
	var applyId = $("#applyId").val();
	var fncCrdnlt = '';
	var stdt = '';
	var eddt = '';
	var pianflag=$('#pianflag').val();//平安信托标示
	var paySchNo=$('#paySchNo').val();//支付表号查询按钮事件 add by gengchunlan 20190813
	//初始化数据
	function initData(){
    	if(!applyId)return;
    	var _url = '<%=path%>/ass/asspackinfo/getById.do';
    	AjaxUtils.ajaxGet(_url, {id:applyId}, initCallback);
	}
	
	//初始化回调
	function initCallback(msg){
		if(msg.success == 1){
			 setData(msg.data);//设置数据
		 }else{
			 UIUtils.alertError(msg.info);
		 }
	}
	
	//修改时候设置页面数据
    function setData(data){
		$("#fncCrdnlt").val(data.fncCrdnltNm);
		$("#stdt").val(data.planStdt);
		$("#eddt").val(data.planEddt);
		if(null != data.cstTypCdNm){
			$("#cstTypCd").val(data.cstTypCdNm);
		}else{
			$("#cstTypCd").val("自然人,法人");
		}
		if(null != data.buOrgCdNm){
			$("#buOrgCd").val(data.buOrgCdNm);
		}else{
			$("#buOrgCd").val("全部");
		}
		if(null != data.isMgtNm){
			$("#isMortgage").val(data.isMgtNm);
		}else{
			$("#isMortgage").val("是,否");
		}
		if(null != data.isInsureNm){
			$("#isInsurance").val(data.isInsureNm);
		}else{
			$("#isInsurance").val("是,否");
		}
		$("#leaseTermMinQ").val(data.leaTermB);
		$("#leaseTermMaxQ").val(data.leaTermE);
		$("#surplusLeaseTermMinQ").val(data.reLeaTermB);
		$("#surplusLeaseTermMaxQ").val(data.reLeaTermE);
		$("#stDtQ").val(data.flDateBegin);
		$("#edDtQ").val(data.flDateEnd);
		$("#ovdDaysMin").val(data.odDateB);
		$("#ovdDaysMax").val(data.odDateE);
		$("#assPackNm").val(data.assPackNm);
	   	$('form').find('input').prop("disabled", true);
	   	$('#paySchNo').prop("disabled", false);//支付表号搜索框add by gengchunlan 20190813
    	fncCrdnlt = data.fncCrdnlt;
    	stdt = data.planStdt;
    	eddt = data.planEddt;
    	initGrid();
	};
	
	//初始化列表
	function initGrid() {
		$("#searchBar").ligerForm({validate: true});
		var _url = '<%=path%>/ass/asspackinfo/fncPrjPayRltvInfo.do';
    	$("#ligergrid1").ligerGrid({
    		url : _url,
    		method : 'get',
    		parms : {"id":applyId,"fncCrdnlt":fncCrdnlt,"stdt":stdt,"eddt":eddt,"paySchNo":paySchNo},
        	columns: [
	            { display: '再融资状态', name: 'financingTypeNm', width: 80},
	            { display: '是否预约', name: 'isYl', width: 60,
	            	render: function (rowdata, rowindex, value){
	            		if(rowdata.isYl == '1' ){
	            			var h="是";
	            		}else{
	            			var h="否";
	            		}
	            		return h;
	            	}
	            },
	            { display: '客户名称', name: 'cstNm', width: 150 },
	            { display: '客户类型', name: 'cstTypNm', width: 100 },
	            { display: '合同编号', name: 'contractNumber', width: 150 },
	            { display: '事业部', name: 'buOrgNm', width: 100 },
	            { display: '支付表编号', name: 'paySchId',
	            	
	              render: function (rowdata, rowindex, value, column) { 
	            		var h = '';
	            		var pinan ="${pianflag}";
	            			if(null !=pinan && "101"==pinan){
	            				h='<a href="javascript:detailBtn(';
	 	                        h+="'"+rowdata.prjPrdDtlId+"',";
	 	                        h+="'"+rowdata.id+"',";
	 	                        h+="'"+rowdata.prjPrdId+"',";
	 	                        h+="'"+rowdata.prjId+"'";
	 	                        h+=')">'+value+'</a>'
	            			}else{
	            				h+=value;
	            			}
	                        return h;
	            		},
	             width: 200 },
	            { display: '起租日期', name: 'stDate', width: 150, render:renderDate},
	            { display: '可融资金额', name: 'financingAmount', width: 150 },
	            { display: '操作',  width: 150,//modify by gengchunlan 20190121
	            	 render: function (rowdata, rowindex, value, column) { 
		            		var h = '';
		            		var pinan ="${pianflag}";
		            			if(null !=pinan && "101"==pinan){
		            				h='<a href="javascript:payDetail(';
		 	                        h+="'"+rowdata.id+"'";
		 	                        h+=')"><i class="sqBtnIco_2"></i>查看还款情况</a>'
		            			}
		                        return h;
		           }
	            },
	        ],
	        pageSize:10, 
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:true,
	        rownumbers:true
    	});
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	}
	
	
	
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
   function detailBtn(prjPrdDtlId,id,prjPrdId,prjId){
		var editFlag = true;
		Add_navTab('tab_prj_quat_prps'+id,'查看支付表','<%=path%>/project/prjprdpayschm/toAddPage.do?prjId='+prjId+'&&id='+id+'&&prjPrdDtlId='+prjPrdDtlId+'&&prjPrdId='+prjPrdId+'&&detailFlag='+editFlag+'&&pian=101');
   }
   function payDetail(id){//add by gengchunlan 20190121
		var payDetailUrl = '<%=path%>/project/prjprdpayschm/toPrjPrdPaySchMDetailPage.do?id='+id;
		Add_navTab('tab_prj_quat_prps_pay'+id,'查看还款情况',payDetailUrl);
	}
 	//查询按钮事件 add by gengchunlan 20190618
	function searchBtnEvent(){
		$("#searchBtn").click(function(event) {
			var paySchNo=$('#paySchNo').val();
			var ovdDaysMax=$('#ovdDaysMax').val();
			var ovdDaysMin=$('#ovdDaysMin').val();
			grid.setParm('id',applyId);
			grid.setParm('fncCrdnlt',fncCrdnlt);
			grid.setParm('stdt',stdt);
			grid.setParm('eddt',eddt);
			grid.setParm('paySchNo',paySchNo);
			grid.setParm('ovdDaysMax',ovdDaysMax);
			grid.setParm('ovdDaysMin',ovdDaysMin);
			grid.reload();
		});
	}//end by gengchunlan 
</script>
</body>
</html>
